package DataAccess
{
	import mx.collections.ArrayCollection;
	import mx.core.FlexGlobals;
	import mx.rpc.CallResponder;
	import mx.rpc.events.ResultEvent;
	
	import Model.ClimateZone;
	import Model.Project;
	
	import services.climatezonesservice.ClimatezonesService;
	import services.constructionsservice.ConstructionsService;
	import services.doorsservice.DoorsService;
	import services.independentconstructionsservice.IndependentConstructionsService;
	import services.sendemailresultsservice.SendEmailResultsService;
	import services.windowsservice.WindowsService;
	
	import valueObjects.ClimateZones;

	public class DataAccess
	{
		private var climateZoneCallResponder:CallResponder;
		private var climateZoneService:ClimatezonesService;
		
		private var certifiedConstructionsCallResponder:CallResponder;
		private var certifiedConstructionsService:ConstructionsService;
		
		private var independentConstructionsCallResponder:CallResponder;
		private var independentConstructionsService:IndependentConstructionsService;
		
		private var glazingCallResponder:CallResponder;
		private var glazingService:WindowsService;
		
		private var doorsCallResponder:CallResponder;
		private var doorsService:DoorsService;
		
		private var sendEmailResultService:SendEmailResultsService;
		
		public function DataAccess()
		{
			this.climateZoneCallResponder = new CallResponder();
			this.climateZoneService = new ClimatezonesService();
			
			this.certifiedConstructionsCallResponder = new CallResponder();
			this.certifiedConstructionsService = new ConstructionsService();
			
			this.independentConstructionsCallResponder = new CallResponder();
			this.independentConstructionsService = new IndependentConstructionsService();
			
			this.glazingCallResponder = new CallResponder();
			this.glazingService = new WindowsService();
			
			this.doorsCallResponder = new CallResponder();
			this.doorsService = new DoorsService();
			
			this.sendEmailResultService = new SendEmailResultsService();
		}
		
		//Climate service calls
		
		public function getClimateZoneByCountry(id:Number, language:String):void
		{
			this.climateZoneCallResponder = new CallResponder();
			
			if(language == "en_US")
			{
				language = "en_UK";
			}
			
			climateZoneCallResponder.token = climateZoneService.getClimateByCountryID(id , language);
			climateZoneCallResponder.addEventListener(ResultEvent.RESULT, setClimateZones);
		}
		
		protected function setClimateZones(event:ResultEvent):void
		{
			var arr:ArrayCollection = climateZoneCallResponder.lastResult;
			
			var climateZone:ClimateZone;
			
			(FlexGlobals.topLevelApplication.climatezones as ArrayCollection).removeAll();
			
			for each(var zone:ClimateZones in arr)
			{
				climateZone = new ClimateZone();
				
				climateZone.countryId = zone.country_id;
				climateZone.label = zone.name;
				climateZone.ht = zone.ht;
				climateZone.gt = zone.gt;
				climateZone.globalEast = zone.global_east;
				climateZone.globalNorth = zone.global_north;
				climateZone.globalSouth = zone.global_south;
				climateZone.globalWest = zone.global_west;
				climateZone.globalHorizontal = zone.global_horizontal;

				FlexGlobals.topLevelApplication.climatezones.addItem(climateZone);
			}
		}
		
		//Walls against air service calls
		
		public function getWallsAgainstAirWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult2("WC", "VF", "IN", 05, 06, 08);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstAirWCVF);
		}
		
		protected function setWallsAgainstAirWCVF(event:ResultEvent):void
		{		
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstAirWCVF = arr;
		}
		
		public function getWallsAgainstAirWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult2("WC", "CS", "IN", 05, 06, 08);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstAirWCCS);
		}
		
		protected function setWallsAgainstAirWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstAirWCCS = arr;
		}
		
		public function getWallsAgainstAirMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult2("MC", "VF", "IN", 05, 06, 08);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstAirMCVF);
		}
		
		protected function setWallsAgainstAirMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstAirMCVF = arr;
		}
		
		public function getWallsAgainstAirMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult2("MC", "CS", "IN", 05, 06, 08);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstAirMCCS);
		}
		
		protected function setWallsAgainstAirMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstAirMCCS = arr;
		}
		
		public function getWallsAgainstAirIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions2(5, 8, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstAirIndependent);
		}
		
		protected function setWallsAgainstAirIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstAirIndependent = arr;
		}
		
		//Walls against ground service calls
		
		public function getWallsAgainstGroundWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("WC", "VF", "IN", 02, 03, 3);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstGroundWCVF);
		}
		
		protected function setWallsAgainstGroundWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstGroundWCVF = arr;
		}
		
		public function getWallsAgainstGroundWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("WC", "CS", "IN", 02, 03, 3);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstGroundWCCS);
		}
		
		protected function setWallsAgainstGroundWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstGroundWCCS = arr;
		}
		
		public function getWallsAgainstGroundMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("MC", "VF", "IN", 02, 03, 3);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstGroundMCVF);
		}
		
		protected function setWallsAgainstGroundMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstGroundMCVF = arr;
		}
		
		public function getWallsAgainstGroundMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("MC", "CS", "IN", 02, 03, 3);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstGroundMCCS);
		}
		
		protected function setWallsAgainstGroundMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstGroundMCCS = arr;
		}
		
		public function getWallsAgainstGroundIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(2, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWallsAgainstGroundIndependent);
		}
		
		protected function setWallsAgainstGroundIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.wallsAgainstGroundIndependent = arr;
		}
		
		//Pitched roofs service calls
		
		public function getPitchedRoofsWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult3("WC", "VF", "IN", 10, 07, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setPitchedRoofsWCVF);
		}
		
		protected function setPitchedRoofsWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.pitchedRoofsWCVF = arr;
		}
		
		public function getPitchedRoofsWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult3("WC", "CS", "IN", 10, 07, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setPitchedRoofsWCCS);
		}
		
		protected function setPitchedRoofsWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.pitchedRoofsWCCS = arr;
		}
		
		public function getPitchedRoofsMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult3("MC", "CS", "IN", 10, 07, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setPitchedRoofsMCCS);
		}
		
		protected function setPitchedRoofsMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.pitchedRoofsMCCS = arr;
		}
		
		public function getPitchedRoofsMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult3("MC", "VF", "IN", 10, 07, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setPitchedRoofsMCVF);
		}
		
		protected function setPitchedRoofsMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.pitchedRoofsMCVF = arr;
		}
		
		public function getPitchedRoofsIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(10, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setPitchedRoofsIndependent);
		}
		
		protected function setPitchedRoofsIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.pitchedRoofsIndependent = arr;
		}
		
		//Flat roofs service calls
		
		public function getFlatRoofsWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("WC", "VF", "IN", 11, 5);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setFlatRoofsWCVF);
		}
		
		protected function setFlatRoofsWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.flatRoofsWCVF = arr;
		}
		
		public function getFlatRoofsWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("WC", "CS", "IN", 11, 5);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setFlatRoofsWCCS);
		}
		
		protected function setFlatRoofsWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.flatRoofsWCCS = arr;
		}
		
		public function getFlatRoofsMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("MC", "VF", "IN", 11, 5);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setFlatRoofsMCVF);
		}
		
		protected function setFlatRoofsMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.flatRoofsMCVF = arr;
		}
		
		public function getFlatRoofsMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("MC", "CS", "IN", 11, 5);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setFlatRoofsMCCS);
		}
		
		protected function setFlatRoofsMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.flatRoofsMCCS = arr;
		}
		
		public function getFlatRoofsIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(11, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setFlatRoofsIndependent);
		}
		
		protected function setFlatRoofsIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.flatRoofsIndependent = arr;
		}

		//Slabs agaionst ground service calls
		
		public function getSlabsAgainstGroundWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("WC", "VF", "IN", 01, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstGroundWCVF);
		}
		
		protected function setSlabsAgainstGroundWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstGroundWCVF = arr;
		}
		
		public function getSlabsAgainstGroundWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("WC", "CS", "IN", 01, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstGroundWCCS);
		}
		
		protected function setSlabsAgainstGroundWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstGroundWCCS = arr;
		}
		
		public function getSlabsAgainstGroundMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("MC", "VF", "IN", 01, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstGroundMCVF);
		}
		
		protected function setSlabsAgainstGroundMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstGroundMCVF = arr;
		}
		
		public function getSlabsAgainstGroundMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult("MC", "CS", "IN", 01, 05);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstGroundMCCS);
		}
		
		protected function setSlabsAgainstGroundMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstGroundMCCS = arr;
		}
		
		public function getSlabsAgainstGroundIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(1, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstGroundIndependent);
		}
		
		protected function setSlabsAgainstGroundIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstGroundIndependent = arr;
		}
		
		//Slabs against unheated cellar service calls
		
		public function getSlabsAgainstUnheatedCellarWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("WC", "VF", "IN", 02, 03, 1);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstUnheatedCellarWCVF);
		}
		
		protected function setSlabsAgainstUnheatedCellarWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstUnheatedCellarWCVF = arr;
		}
		
		public function getSlabsAgainstUnheatedCellarWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("WC", "CS", "IN", 02, 03, 1);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstUnheatedCellarWCCS);
		}
		
		protected function setSlabsAgainstUnheatedCellarWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstUnheatedCellarWCCS = arr;
		}
		
		public function getSlabsAgainstUnheatedCellarMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("MC", "VF", "IN", 02, 03, 1);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstUnheatedCellarMCVF);
		}
		
		protected function setSlabsAgainstUnheatedCellarMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstUnheatedCellarMCVF = arr;
		}
		
		public function getSlabsAgainstUnheatedCellarMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getSearchResult4("MC", "CS", "IN", 02, 03, 1);
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstUnheatedCellarMCCS);
		}
		
		protected function setSlabsAgainstUnheatedCellarMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstUnheatedCellarMCCS = arr;
		}
		
		public function getSlabsAgainstUnheatedCellarIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(3, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setSlabsAgainstUnheatedCellarIndependent);
		}
		
		protected function setSlabsAgainstUnheatedCellarIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.slabsAgainstUnheatedCellarIndependent = arr;
		}
		
		//Windows service calls
		
		public function getWindowsWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("WC", "VF", "IN", "g");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWindowsWCVF);
		}
		
		protected function setWindowsWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.windowsWCVF = arr;
		}
		
		public function getWindowsWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("WC", "CS", "IN", "g");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWindowsWCCS);
		}
		
		protected function setWindowsWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.windowsWCCS = arr;
		}
		
		public function getWindowsMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("MC", "VF", "IN", "g");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWindowsMCVF);
		}
		
		protected function setWindowsMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.windowsMCVF = arr;
		}
		
		public function getWindowsMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("MC", "CS", "IN", "g");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWindowsMCCS);
		}
		
		protected function setWindowsMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.windowsMCCS = arr;
		}
		
		public function getWindowsIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(13, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setWindowsIndependent);
		}
		
		protected function setWindowsIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/thumbnails/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.windowsIndependent = arr;
			getGlazings();
		}
		
		//Glazings service calls
		
		public function getGlazings():void
		{
			this.glazingCallResponder = new CallResponder();
			
			this.glazingCallResponder.token = this.glazingService.getAllWindows();
			this.glazingCallResponder.addEventListener(ResultEvent.RESULT, setGlazings);
		}
		
		protected function setGlazings(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/window_drawings/thumbnails/" + res.url_drawing;
				res.window = FlexGlobals.topLevelApplication.windowsIndependent[0];
			}
			
			FlexGlobals.topLevelApplication.glazings = arr;
		}
		
		//Doors glazing service calls
		
		public function getDoors():void
		{
			this.doorsCallResponder = new CallResponder();
			
			this.doorsCallResponder.token = this.doorsService.getAllDoors();
			this.doorsCallResponder.addEventListener(ResultEvent.RESULT, setDoors);
		}
		
		protected function setDoors(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/door_drawings/thumbnails/" + res.url_drawing;
				res.door = FlexGlobals.topLevelApplication.doorsIndependent[0];
			}
			
			FlexGlobals.topLevelApplication.doors = arr;
		}
		
		//Doors service calls
		
		public function getDoorsWCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("WC", "VF", "IN", "d");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setDoorsWCVF);
		}
		
		protected function setDoorsWCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.doorsWCVF = arr;
		}
		
		public function getDoorsWCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("WC", "CS", "IN", "d");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setDoorsWCCS);
		}
		
		protected function setDoorsWCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.doorsWCCS = arr;
		}
		
		public function getDoorsMCVF():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("MC", "VF", "IN", "d");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setDoorsMCVF);
		}
		
		protected function setDoorsMCVF(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.doorsMCVF = arr;
		}
		
		public function getDoorsMCCS():void
		{
			this.certifiedConstructionsCallResponder = new CallResponder();
			
			this.certifiedConstructionsCallResponder.token = this.certifiedConstructionsService.getWindowsAndDoors("MC", "CS", "IN", "d");
			this.certifiedConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setDoorsMCCS);
		}
		
		protected function setDoorsMCCS(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/en_UK/" + res.constr_id.toString() + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.doorsMCCS = arr;
		}
		
		public function getDoorsIndependent():void
		{
			this.independentConstructionsCallResponder = new CallResponder();
			
			this.independentConstructionsCallResponder.token = this.independentConstructionsService.getConstructions(14, "en_UK");
			this.independentConstructionsCallResponder.addEventListener(ResultEvent.RESULT, setDoorsIndependent);
		}
		
		protected function setDoorsIndependent(event:ResultEvent):void
		{
			var arr:ArrayCollection = event.result as ArrayCollection;
			
			for each(var res:Object in arr)
			{
				res.pictureURL = "http://www.isover-construction.com/drawings/independent_constructions/en_UK/thumbnails/" + res.construction_id + ".jpg";
			}
			
			FlexGlobals.topLevelApplication.doorsIndependent = arr;
			getDoors();
		}
		
		public function sendResultsToEmail(repicient:String, data:Project):void
		{
			this.sendEmailResultService.sendEmail(repicient, data);
		}
		
	}
}